/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package br.com.jr2tecnologia.model.entity;

import java.io.Serializable;
import java.util.List;
import javax.persistence.Basic;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.SequenceGenerator;
import javax.persistence.Table;

/**
 *
 * @author ronildo
 */
@Entity
@Table(name = "company")
@NamedQueries({
    @NamedQuery(name = "Company.findAll", query = "SELECT c FROM Company c order by c.name"),
    @NamedQuery(name = "Company.findByPkCompany", query = "SELECT c FROM Company c WHERE c.pkCompany = :pkCompany"),
    @NamedQuery(name = "Company.findByName", query = "SELECT c FROM Company c WHERE c.name = :name"),
    @NamedQuery(name = "Company.findByDescription", query = "SELECT c FROM Company c WHERE c.description = :description"),
    @NamedQuery(name = "Company.findByValueSendSms", query = "SELECT c FROM Company c WHERE c.valueSendSms = :valueSendSms")})
public class Company implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @Basic(optional = false)
    @Column(name = "pk_company")
    @GeneratedValue(strategy = GenerationType.SEQUENCE, generator="seq_company")
    @SequenceGenerator(name="seq_company", sequenceName="seq_company", allocationSize=1)
    private Long pkCompany;
    @Basic(optional = false)
    @Column(name = "name")
    private String name;
    @Column(name = "description")
    private String description;
    @Basic(optional = false)
    @Column(name = "value_send_sms")
    private Double valueSendSms;
    @OneToMany(mappedBy = "company")
    private List<Modem> modemList;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "company")
    private List<ClientPhone> clientPhoneList;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "company")
    private List<Login> loginList;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "company")
    private List<BankAccount> bankAccountList;

    public Company() {
    }

    public Company(Long pkCompany) {
        this.pkCompany = pkCompany;
    }

    public Company(Long pkCompany, String name, Double valueSendSms) {
        this.pkCompany = pkCompany;
        this.name = name;
        this.valueSendSms = valueSendSms;
    }

    public Long getPkCompany() {
        return pkCompany;
    }

    public void setPkCompany(Long pkCompany) {
        this.pkCompany = pkCompany;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getDescription() {
        return description;
    }

    public void setDescription(String description) {
        this.description = description;
    }

    public Double getValueSendSms() {
        return valueSendSms;
    }

    public void setValueSendSms(Double valueSendSms) {
        this.valueSendSms = valueSendSms;
    }

    public List<Modem> getModemList() {
        return modemList;
    }

    public void setModemList(List<Modem> modemList) {
        this.modemList = modemList;
    }

    public List<ClientPhone> getClientPhoneList() {
        return clientPhoneList;
    }

    public void setClientPhoneList(List<ClientPhone> clientPhoneList) {
        this.clientPhoneList = clientPhoneList;
    }

    public List<Login> getLoginList() {
        return loginList;
    }

    public void setLoginList(List<Login> loginList) {
        this.loginList = loginList;
    }

    public List<BankAccount> getBankAccountList() {
        return bankAccountList;
    }

    public void setBankAccountList(List<BankAccount> bankAccountList) {
        this.bankAccountList = bankAccountList;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (pkCompany != null ? pkCompany.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Company)) {
            return false;
        }
        Company other = (Company) object;
        if ((this.pkCompany == null && other.pkCompany != null) || (this.pkCompany != null && !this.pkCompany.equals(other.pkCompany))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "br.com.jr2tecnologia.model.entity.Company[pkCompany=" + pkCompany + "]";
    }

}
